<?php

class fw_view{
	private  $viewDate = array();
	private  $html = null;
	function fw_view(){
		
	}
	
	public function exView($layout,$view,$data=null){
		$this->html= Fw::app()->load('html');
		
		if(!empty($data)){
			$this->viewDate = $data;
		}
		
		extract($this->viewDate);
		//$this->html->start();
		$action = Fw::app()->getContorllerAction();
	
		if(!empty($layout)){
			
			$content= APPTAPH."/view/".$action['contorller']."/".$view.".php";
			
		    require_once APPTAPH.'/view/layout/'.$layout.".php";
		    
		}else{
			
			require_once APPTAPH.'/view/'.$action['contorller'].'/'.$view.".php";
			
		}
		
		//$this->html->end(2);
		
		
		//$this->html->get(2);
	}
	
	public function requireFile($content){
		
		require_once $content;
		
	}
	
	public  function showError(){
		return '<div class="alert"> <button data-dismiss="alert" class="close" type="button">×</button><strong>Warning!</strong> Best check yo self, you\'re not looking too good. </div>';
	}
}